package sort;

import java.util.Arrays;

public class InsertSort {
	public static void main(String[] args) {
		int[] arr = new int[]{3,6,1,8,2,0};
		insertSort(arr);
		System.out.println(Arrays.toString(arr));
	}

	private static void insertSort(int[] arr) {
		int select,j;
		for(int i=1; i<arr.length; i++){
			select = arr[i];
			j = i;
			while(j>0&&arr[j-1]>=select){
				arr[j] = arr[j-1];
				j--;
			}
			arr[j] = select;
		}
	}
	
	
}
